import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

public class ExecutorTest3 {
    public static void main(String[] args) {
        ExecutorService service= Executors.newFixedThreadPool(5);
        service.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("我是任务1");
            }
        });

        service.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("我是任务2");
            }
        });
        service.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("我是任务3");
            }
        });
        service.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("我是任务4");
            }
        });
    }
}
